﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model.LoginModel;
using Model.System.User;
using Service.System;
using System.Threading.Tasks;

namespace Webapi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LoginController : LXYControllerBase
    {
        private readonly UserService _userService;

        public LoginController(UserService userService)
        {
            _userService = userService;
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="login"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> LoginAsync([FromBody] LoginDto login)
        {
            sys_user user = await _userService.SelectLoginAsync(login.UserName);
            if (user == null)
            {
                return Error("用户名不存在");
            }
            return Success("");
        }
    }
}
